package com.itany.thread.test03;

public class ProductPool {
	// 当前缓冲区商品数量
	private int num;
	private static final int MAX_NUM = 30;
	
	// 生产商品
	public int put(){
		num++;
		return num;
	}
	
	// 消费商品
	public int get(){
		num--;
		return num;
	}
	
	// 缓冲区是否为空
	public boolean isEmpty(){
		return this.num == 0;
	}
	
	// 缓冲区是否已满
	public boolean isFull(){
		return this.num == MAX_NUM;
	}
}
